﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Simple.Repository.Migrations
{
    public partial class _30 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Class_DynamicLike",
                columns: table => new
                {
                    ClassDynamicId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "动态id", collation: "ascii_general_ci"),
                    ParentOrTeacherId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "家属id/老师id", collation: "ascii_general_ci"),
                    LoginType = table.Column<int>(type: "int", nullable: true, comment: "登录类型"),
                    LikeParentName = table.Column<string>(type: "longtext", nullable: true, comment: "点赞人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Relationship = table.Column<string>(type: "longtext", nullable: true, comment: "关系")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LikeDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "点赞时间"),
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "主键", collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "软删标记"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "创建时间"),
                    CreatedUserId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "创建用户Id", collation: "ascii_general_ci"),
                    UpdatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "更新时间"),
                    UpdatedUserId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "更新用户Id", collation: "ascii_general_ci"),
                    OrganizationId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "机构Id", collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Class_DynamicLike", x => x.ClassDynamicId);
                    table.ForeignKey(
                        name: "FK_Class_DynamicLike_Class_Dynamic_ClassDynamicId",
                        column: x => x.ClassDynamicId,
                        principalTable: "Class_Dynamic",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateIndex(
                name: "IX_Class_DynamicLike_ClassDynamicId",
                table: "Class_DynamicLike",
                column: "ClassDynamicId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Class_DynamicLike");
        }
    }
}
